//
//  DYEnterShopVC.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/11.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYEnterShopVC.h"
#import "DYEnterShopView.h"
#import "DYAgreementVC.h"

@interface DYEnterShopVC ()

@property (nonatomic,strong)DYEnterShopView *shopView;

@end

@implementation DYEnterShopVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title=@"入驻开店";
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    [self.view addSubview:self.shopView];
}
- (void)alertSuccessShow
{
    UIAlertController *alert =  [XHQAlertManager alertActionCreateTitle:nil andMassage:@"\n\n\n\n\n" setActionEnterText:@"商铺装修" setActionCancelText:@"返回首页" setEnterAction:^(UIAlertAction *action) {
       
    } setCancelAction:^(UIAlertAction *action) {
         [self.navigationController popViewControllerAnimated:YES];
    }];

   
    UIButton *button = [self buttonWithTtitle:@"开店成功" imageName:@"icon_suc"];
    
    [alert.view addSubview:button];
    [self presentViewController:alert animated:YES completion:nil];
}
-(DYEnterShopView *)shopView
{
    if (!_shopView) {
        _shopView=[[DYEnterShopView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-kNavigationStatusHeight)];
        
        @weakify(self);
        _shopView.enterShopBlock = ^(NSInteger type) {
            @strongify(self);
            if (type==1) {
                [self alertSuccessShow];
            }else{
                DYAgreementVC *vc=[[DYAgreementVC alloc]init];
                vc.navigationItem.title=@"入驻协议";
                [self.navigationController pushViewController:vc animated:YES];
            }
        };
    }
    return _shopView;
}
- (UIButton *)buttonWithTtitle:(NSString *)title imageName:(NSString *)imageName
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(20, 25, 230, 90);
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:[UIColor xhq_content] forState:UIControlStateNormal];
    button.xhqFont = XHQ_FONT(17);
    [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [button xhq_setImagePosition:XHQImagePositionTop spacing:10];
    return button;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
